package com.weic.test01.processer;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

public class MyProcesser implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        //bean：构造的bean
        //beanName：bean的id
        System.out.println("bean :"+bean +" name is :" +beanName + "postProcessBeforeInitialization  ");
        return bean;//此方法若返回空则构造的bean将为null
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("bean :"+bean +" name is :" +beanName + "postProcessAfterInitialization  ");
        return bean;
    }
}
